package com.loveedu.Interceptor;

import com.alibaba.fastjson.asm.Type;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.serializer.SerializeWriter;

import java.io.IOException;

/**
 * Created by Administrator on 2018-5-26.
 */
public class SwaggerJsonSerializer implements ObjectSerializer, ObjectDeserializer {

    public final static SwaggerJsonSerializer instance = new SwaggerJsonSerializer();


    @Override
    public int getFastMatchToken() {
        return 0;
    }

    @Override
    public <T> T deserialze(DefaultJSONParser defaultJSONParser, java.lang.reflect.Type type, Object o) {
        return null;
    }

    @Override
    public void write(JSONSerializer jsonSerializer, Object o, Object o1, java.lang.reflect.Type type, int i) throws IOException {
        SerializeWriter out = jsonSerializer.getWriter();
        Json json = (Json) o1;
        out.write(json.value());
    }
}